package cn.edu.suda.catalina.util;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;

/**
 * Created by gzy on 2016/6/21.
 */

public class MSQLiteOpenHelper extends SQLiteOpenHelper {

    public static final String DATABASE_NAME = "diary.db";
    public static final String DATABASE_TABLE = "diary";
    public static final int DATABASE_VERSION = 1;

    public static final String TABLE_ID = "id";
    public static final String TABLE_TIME = "time";
    public static final String TABLE_DIARY = "diary";

    private static final String DATABASE_CREATE = "create table "
            + DATABASE_TABLE + "("
            + TABLE_ID + " Integer primary key autoincrement, "
            + TABLE_TIME + " text, "
            + TABLE_DIARY + " text)";

    public MSQLiteOpenHelper(Context context, String name, SQLiteDatabase.CursorFactory factory, int version) {
        super(context, name, factory, version);
    }

    @Override
    public void onCreate(SQLiteDatabase db) {
        db.execSQL(DATABASE_CREATE);
    }

    @Override
    public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {

    }
}
